<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<meta http-equiv="Content-Type" content="text/html;" charset="<?php echo CHARSET;?>">
<title>本地生活</title>
<link href="/mxd_web/Public/admin/css/skin_0.css" rel="stylesheet" type="text/css" id="cssfile"/>
<script type="text/javascript" src="/mxd_web/Public/static/jquery.js"></script>
<script type="text/javascript" src="/mxd_web/Public/static/jquery.validation.min.js"></script>
<script type="text/javascript" src="/mxd_web/Public/admin/js/jquery.cookie.js"></script>
<script type="text/javascript" src="/mxd_web/Public/admin/js/admincp.js"></script>
<script type="text/javascript" src="/mxd_web/Public/admin/js/jquery.tooltip.js"></script>
<script language="javascript">
var SiteUrl = '<?php echo (C("SiteUrl")); ?>';
var AdminUrl = SiteUrl+'/<?php echo (MODULE_NAME); ?>';
</script>
</head><body>
<div class="page">
  <div class="fixed-bar">
    <div class="item-title">
      <h3>菜单管理</h3>
      <ul class="tab-base">
        <li><a href="JavaScript:void(0);" class="current"><span>管理</span></a></li>
      </ul>
    </div>
  </div>
  <div class="fixed-empty"></div>
  
  <table class="table tb-type2" id="prompt">
    <tbody>
      <tr class="space odd">
        <th class="nobg" colspan="12"><div class="title"><h5>操作提示</h5><span class="arrow"></span></div></th>
      </tr>
      <tr>
        <td>
        <ul>
           <li>菜单编辑规范：一级菜单最多4个汉字，二级菜单最多7个汉字</li>
           <li>菜单编辑好后，需要提交到服务器，由于微信客户端缓存，需要24小时微信客户端才会展现出来</li>
        </ul>
        </td>
      </tr>
    </tbody>
  </table>
  
  <form method='post'>
    <input type="hidden" name="form_submit" value="ok" />
    <input type="hidden" name="submit_type" id="submit_type" value="" />
    <table class="table tb-type2">
      <thead>
        <tr class="thead">
          <th class="w48 sort">排序</th>
          <th class="w25pre name">分类名称</th>
          <th>类型</th>
          <!--<th>数据</th>-->
          <th>状态</th>
          <th>操作</th>
        </tr>
      </thead>
      <tbody>
      
   <?php if(is_array($list)): $i = 0; $__LIST__ = $list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><tr class="hover edit">
              <td class="w48 sort" id="list-<?php echo ($v['id']); ?>">
              <span title="可编辑" ajax_branch="sort" ajax_control="Weixin" datatype="number" fieldid="<?php echo ($vo['id']); ?>" fieldname="sort" nc_type="inline_edit" class="editable tooltip"><?php echo ($vo['sort']); ?></span>
              </td>
              <td class="w25pre name">
               <span title="可编辑" required="1" fieldid="<?php echo ($vo['id']); ?>" ajax_branch="name" ajax_control="Weixin" fieldname="name" nc_type="inline_edit" class="editable tooltip"><?php echo ($vo["name"]); ?></span>
              </td>
              <td><?php echo ($vo['type']); ?></td>
              <!--<td><?php echo ($vo['key_url']); ?></td>-->
            <td class="power-onoff">            
          <a href="JavaScript:void(0);" class="tooltip <?php if(($vo['is_show']) == "1"): ?>enabled<?php else: ?>disabled<?php endif; ?>" fieldvalue="<?php echo ($vo["id"]); ?>" id="pra-<?php echo ($vo["id"]); ?>" ajax_control="Weixin" ajax_branch="is_show" fieldname="is_show" nc_type="inline_edit" title="<?php if(($vo['is_show']) == "1"): ?>关闭<?php else: ?>开启<?php endif; ?>"><img src="/mxd_web/Public/admin/images/transparent.gif"></a>
            </td>
              <td class="w48">
                <a dialog_id="edit" nc_type="dialog" dialog_title="菜单编辑" dialog_width="500" uri="<?php echo U('Weixin/wx_menu_edit',array('id'=>$vo['id']));?>" href="javascript:void(0);">编辑</a>
              </td>
          </tr>
       
     <?php if(is_array($vo['sub'])): $i = 0; $__LIST__ = $vo['sub'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;?><tr class="hover edit row3" id="list-<?php echo ($v['id']); ?>">
        <td class="w48 sort">
        <span class="tooltip editable" nc_type="inline_edit" fieldname="sort" fieldid="<?php echo ($v["id"]); ?>" datatype="number" ajax_control="Weixin" ajax_branch="sort" title="可编辑下级分类排序"><?php echo ($v['sort']); ?></span>
        </td>
        <td class="w25pre name">
        <img src="/mxd_web/Public/admin/images/tv-expandable1.gif" nc_type="flex" status="none" fieldid="4">
        <span title="可编辑" required="1" fieldid="<?php echo ($v["id"]); ?>" ajax_branch="name" ajax_control="Weixin" fieldname="name" nc_type="inline_edit" class="editable tooltip"><?php echo ($v["name"]); ?></span>
        </td>
        <td><?php echo ($v['type']); ?></td>
        <!--<td><?php echo ($v['key_url']); ?></td>-->
        <td class="power-onoff">            
          <a href="JavaScript:void(0);" class="tooltip <?php if(($v['is_show']) == "1"): ?>enabled<?php else: ?>disabled<?php endif; ?>" fieldvalue="<?php echo ($v["id"]); ?>" id="sub-<?php echo ($v["p_id"]); ?>-<?php echo ($v["id"]); ?>" pid="<?php echo ($v["p_id"]); ?>" ajax_control="Weixin" ajax_branch="is_show" fieldname="is_show" nc_type="inline_edit" title="<?php if(($v['is_show']) == "1"): ?>关闭<?php else: ?>开启<?php endif; ?>"><img src="/mxd_web/Public/admin/images/transparent.gif"></a>
        </td>
        <td class="w48">
        <a dialog_id="edit" nc_type="dialog" dialog_title="菜单编辑" dialog_width="500" uri="<?php echo U('Weixin/wx_menu_edit',array('id'=>$v['id']));?>" href="javascript:void(0);">编辑</a>
        </td>
        </tr><?php endforeach; endif; else: echo "" ;endif; endforeach; endif; else: echo "" ;endif; ?>       
        </tbody>
        <tfoot>
        <tr class="tfoot">
          <td id="batchAction" colspan="15">      
            <a href="<?php echo U('Weixin/post_menu');?>" class="btn"><span>提交到服务器</span></a>
          </td>
        </tr>
      </tfoot>
          </table>
  </form>
</div>
<script type="text/javascript" src="/mxd_web/Public/static/common.js"></script>  
<script language="javascript" src="/mxd_web/Public/static/dialog/dialog.js"  id="dialog_js" charset="utf-8"> </script> 
<script type="text/javascript" src="/mxd_web/Public/static/jquery-ui/jquery.ui.js"></script> 
<script type="text/javascript" src="/mxd_web/Public/static/jquery-ui/i18n/zh-CN.js" charset="utf-8"></script>
<link rel="stylesheet" type="text/css" href="/mxd_web/Public/static/jquery-ui/themes/ui-lightness/jquery.ui.css"  />
<link href="/mxd_web/Public/static/dialog/custom.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="/mxd_web/Public/admin/js/jquery.editWx.js" charset="utf-8"></script>
<script type="text/javascript">
	$(document).ready(function(){
		$('a[id^="sub-"]').click(function(){
			var menuid = $(this).attr('fieldvalue');
			var praid = $(this).attr('pid');
			var URL = '<?php echo (C("SiteUrl")); ?>'+"/Toadmin/Weixin/isShow";
			var cla = 'tooltip';
			var data = {'menuid':menuid,'class':cla};
			$.post(URL,data,function(info){
				$('#sub-'+praid+'-'+menuid).removeClass().addClass(info);
			});
		});
		$('a[id^="pra-"]').click(function(){
			var menuid = $(this).attr('fieldvalue');
			var URL = '<?php echo (C("SiteUrl")); ?>'+"/Toadmin/Weixin/isShow";
			var cla = 'tooltip';
			var data = {'menuid':menuid,'class':cla};
			$.post(URL,data,function(info){
				$('#pra-'+menuid).removeClass().addClass(info);
				$('a[id^="sub-'+menuid+'-"]').removeClass().addClass(info);
			});
		});
	});
</script>
<script type="text/javascript">
$('a[nc_type="dialog"]').click(function(){
	var id = $(this).attr('dialog_id');
	var title = $(this).attr('dialog_title') ? $(this).attr('dialog_title') : '';
	var url = $(this).attr('uri');
	var width = $(this).attr('dialog_width');
	CUR_DIALOG = ajax_form(id, title, url, width,0);
	return false;
});
</script>
</body></html>